
// 1.当前页面的样式
require('./my.less');

// 2.公用js ---操作DOM,发送ajax,验证工具,本地存储
let dom = require('../../utils/dom.js');
require('../../assets/css/index.less');

require('../../assets/fontss/iconfont.css');

require('../../assets/fonts/iconfont.css');

let https = require('../../utils/https')

require('../../lib/weui/weui.css')
let weui = require('../../lib/weui/weui.min.js')

// 3.当前页面的js
dom.ready(function () {
   dom.boop('my')

   console.log('表示当前页面的js代码----此处为功能代码');

   // dom.getEle('#box').addEventListener('change', function () {
   //    let upFile = this.files[0];

   //    let fd = new FormData();

   //    fd.append('file', upFile)

   //    console.dir(fd.get('file'));
   // })

   dom.getEle('#box').addEventListener('change', function () {
      let upfile = this.files[0];


      let fd = new FormData();

      fd.append('file', upfile)
      console.dir(fd.get('file'))


      https.post('/api/shared/uploadPortrait', fd, function (res) {
         console.log(res);
         if (res.errno == 0) {
            console.log(res.data.url);

            dom.getEle('#headPic').src = 'http://fitness.h5.itsource.cn:3701' + res.data.url;
         } else {
            alert('失败')
         }
      })
   })

})